package com.solcoo.merchant;

import android.app.Application;
import android.content.Context;

import com.solcoo.common.App;
import com.solcoo.common.util.StringUtil;
import com.solcoo.merchant.manager.UserManager;
import com.solcoo.merchant.model.User;

public class ApplicationExt extends Application {

	private static ApplicationExt mInstance;

	private Context mContext;

	@Override
	public void onCreate() {
		super.onCreate();
		mInstance = this;
		mContext = getApplicationContext();
		App.init(this);// 初始化系统变量
		App.DISPLAY.DEFAULT_IMG = R.drawable.default_loading;// 设置默认加载图标
	}

	public static ApplicationExt getInstance() {
		return mInstance;
	}

	public Context getCurrentContext() {
		return mContext;
	}

	public String getCurrentContextName() {
		return StringUtil.objectToString(mContext);
	}

	public void setCurrentContext(Context context) {
		mContext = context;
	}

	public static User getUser() {
		return UserManager.getInstance().getUser();
	}

	public static void destory() {
		App.destory();
		android.os.Process.killProcess(android.os.Process.myPid());
	}

}
